<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../css/weui.css">
    <link rel="stylesheet" href="../css/font-awesome.min.css">
    <style type="text/css">
        html, body, div{background: #fff;}
        #app{
            background: #fff;
            text-align: center;
        }
        .user_name,.user_pwd{width: 60%;margin-left: 10%;height: 30px;text-align: left;font-size: 20px;border-bottom: 1px solid #585858;}
        .login{
            width: 140px;height: 30px; margin: 0 auto;border-radius: 14px; background: #fff;
            border: 1px solid #EA1E39;
            line-height: 30px;
            font-size: 14px;
            font-family: 'Microsoft YaHei';
            letter-spacing:4px;
            color: #EA1E39;
            margin-top: 20px;
        }
        .text{width: 80px;margin-left: 30px;font-size: 16px;margin-top: 20px;color: #585858;text-align: left;text-indent: 8px;}

    </style>
</head>
<body>
    <div id="app">
        <div style="padding:0px 0;width:100%;background:#E51C23; text-align: center;margin-top: 0px;border-radius: 0 0 14px 14px;">
            <img src="../image/login.png" style="width:55%;">
            <p style="color:#fff;font-size:12px; padding-bottom:40px;padding-top: 10px;">瓷砖行业电商交流平台</p>
        </div>
        <div>
            <div style="width: 14px;height: 14px;float: left;margin-left: 15px;margin-top: 35px;"><img src="../image/user.png" style="width: 14px;height: 14px;"></div>
            <div style="width: calc(100% - 44px);height: 40px;font-size: 25px;float: left;background: ;margin-left: 10px;margin-top: 30px;"><input type="text"  placeholder="请输入手机号" id="mobile" style="width: calc(100% - 14px);height: 30px;float: left;border:none;border-bottom: 1px solid #585858;outline:medium;outline:none;"></div>
        </div>
        <div>
            <div style="width: 14px;height: 14px;float: left;margin-left: 15px;margin-top: 35px;"><img src="../image/pwd.png" style="width: 14px;height: 14px;"></div>
            <div style="width: calc(100% - 44px);height: 40px;font-size: 25px;float: left;background: ;margin-left: 10px;margin-top: 30px;"><input type="password"  placeholder="请输入密码" id="pwd" style="width: calc(100% - 14px);height: 30px;float: left;border:none;border-bottom: 1px solid #585858;outline:medium;outline:none;"></div>
        </div>

        <label for="weuiAgree" class="weui-agree" style="text-align: left;text-indent: 24px;">
            <input type="checkbox" class="weui-agree__checkbox" checked="checked" id="remember">
            <span class="weui-agree__text">
                记住密码
            </span>
            <a href="javascript:void(0);" onclick="" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
            <a href="javascript:void(0);" onclick="openWin('reg','账号注册',false)" style="float:;">&nbsp;&nbsp;&nbsp;&nbsp;注册账号|</a>
            <a href="javascript:void(0);" onclick="openWin('find_password','忘记密码',false)" style="float:;">忘记密码&nbsp;</a>
        </label>

        <div class="login" onclick="do_login()">登录</div>
        <div style="font-weight:normal;font-size: 12px;margin-top: 15px;" onclick="openWin('upload_mobile','更换设备',false)">更换设备需验证码验证</div>

</body>

<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
apiready = function() { 
    if (localStorage.mobile != "" && localStorage.mobile != undefined) {
        $('#mobile').val(localStorage.mobile);
        $('#pwd').val(localStorage.pwd);
    }
};  

function do_login(){
    var mobile = $('#mobile').val();
    var pwd = $('#pwd').val();
    ajax("/login",{
        "mobile":mobile,
        "pwd":pwd,
        "device_id":api.deviceId
    },function(ret){
        localStorage.user_id = ret.data.id;
        localStorage.user_type = ret.data.type;
        localStorage.user_name = ret.user_name;
        localStorage.md5_pwd = ret.data.pwd;
        if ($("#remember").get(0).checked) {
            localStorage.mobile = mobile;
            localStorage.pwd = pwd;
        }else{
            localStorage.mobile = "";
            localStorage.pwd = "";
        }
        chat_reg(ret.data.id,ret.data.pwd);
        toast("APP登录成功！");
        api.rebootApp();
    });
} 


</script>

</html>
